import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router'

import Home from '@/pages/Home.vue'
import About from '@/pages/About.vue'
import News from '@/pages/News.vue'
import Detail from '@/pages/Detail.vue'

const routes = [
    {
        path: '/',
        redirect:'/home'
    },
    {
        name: 'zhuye',
        path: '/home',
        component: Home
    },
    {
        path: '/about',
        component: About
    },
    {
        path: '/news',
        component: News,
        children: [
            {
                name: 'xiang',
                path: 'detail',
                component: Detail,
                props(route){
                   return {
                    id:route.query.id,
                    title:route.query.title,
                    content:route.query.content
                   }
                }
            }
        ]
    }
]

const router = createRouter({
    history: createWebHistory(),
    routes
})

export default router